		*********************************************
		**** Omer Yair & Raanan Sulitziano-Kenan ****
		******** Distance Breeds Alienation *********
		************* Replication files *************
		*********************************************


* Changing the working directory
cd "C:\Users\bronc\Desktop"

* Load data (.dta)
use "JPSE_dataset.dta", clear


		*******************************************
		*** Analysis conducted in the main text ***
		*******************************************

set more off
********************************
** Cronbach's Alpha of our DV **
********************************
pwcorr Q5 Q6 if IMC2==1, sig
alpha Q5 Q6 if IMC2==1, i
pwcorr Q5 Q6, sig
alpha Q5 Q6, i

sum care if IMC2==1
sum care 

sum SPIG_With_Neut_Corrected if IMC2==1
sum SPIG_With_Neut_Corrected 

****************************
** Testing our hypothesis **
****************************

** Correlations **
pwcorr care SPIG_With_Neut_Corrected if IMC2==1 , sig obs /* r=-.14, p <.001*/
pwcorr care SPIG_With_Neut_Corrected , sig obs /* r=-.12, p <.001*/

*************
** Table 1 **
*************

** Model 1 - With dummies for Department & University & Questionnaire_Versions
regress care SPIG_With_Neut_Corrected i.department i.university i.Q_Version if IMC2==1, cluster (Coding_Order)
outreg2 using Table_1.doc, replace se dec(3) alpha (.001, .01, .05, .1) symbol (***, **, *, +) ///
drop (i.department i.university i.Q_Version) ///
addtext(Universities and departments controls, "YES", Matching on observables, "NO")  


** Model 2 - With individual level variables + Department & University & Questionnaire_Versions Dummies.
set more off
regress care SPIG_With_Neut_Corrected Age gender Religiosity Trust ///
Political_Interest R_Ideology Total_no_of_teachers Diversity_count8	 ///
i.department i.university i.Q_Version if IMC2==1, cluster (Coding_Order)
margins, atmeans at(SPIG_With_Neut_Corrected=(0 1 2 3 4 5 6))
marginsplot

outreg2 using Table_1.doc, append se dec(3) alpha (.001, .01, .05, .1) ///
symbol (***, **, *, +) drop (i.department i.university i.Q_Version) ///
addtext(Universities and departments controls, "YES", Matching on observables, "NO") 


** Model 3 - Matching 
* Creating an average-based split in the Perceived Ideological Distance measure
sum SPIG_With_Neut_Corrected if IMC2==1, 
gen SPIG_high_avg=1 if SPIG_With_Neut_Corrected>1.096431  & SPIG_With_Neut_Corrected<=6
replace SPIG_high_avg=0 if SPIG_With_Neut_Corrected>=0 & SPIG_With_Neut_Corrected<= 1.096431  

* An analysis with the average-based split
*ssc install ebalance
set more off
ebalance SPIG_high_avg Age gender Religiosity Trust Political_Interest ///
R_Ideology Total_no_of_teachers Diversity_count8 if IMC2==1, targets(1)
svyset [pweight=_webal]
svy: regress care SPIG_high_avg i.department i.university i.Q_Version if IMC2==1
outreg2 using Table_1.doc, append se dec(3) alpha (.001, .01, .05, .1) ///
symbol (***, **, *, +) keep (SPIG_high_avg) ///
addtext(Universities and departments controls, "YES", Matching on observables, "YES")  ///
addnote(All models also control for the different questionnaire versions.)

* A models with individual-level controls (results not shown in the main text)
svy: regress care SPIG_high_avg Age gender Religiosity ///
Trust Political_Interest R_Ideology Total_no_of_teachers Diversity_count8 ///
i.department i.university i.Q_Version if IMC2==1

* A models with no controls (results not shown in the main text)
svy: regress care SPIG_high_avg if IMC2==1
drop SPIG_high_avg

** Model 4 - Interaction b/w the PIG item and right-wing students
regress care SPIG_With_Neut_Corrected Age gender Religiosity Trust Political_Interest ///
R_Ideology Total_no_of_teachers Diversity_count8 i.department i.university ///
i.Q_Version right SPIG_right if IMC2==1, cluster (Coding_Order)
outreg2 using Table_1.doc, append se dec(3) alpha (.001, .01, .05, .1) ///
symbol (***, **, *, +) drop (i.department i.university i.Q_Version)  ///
addtext(Universities and departments controls, "YES", Matching on observables, "NO")  ///
addnote(All models also control for the different questionnaire versions.)

* Calculting the PIG coefficient among right-wing students;
regress care SPIG_With_Neut_Corrected Age gender Religiosity Trust Political_Interest ///
R_Ideology Total_no_of_teachers Diversity_count8 i.department i.university ///
i.Q_Version right SPIG_right if IMC2==1, cluster (Coding_Order)
lincom SPIG_With_Neut_Corrected+ SPIG_right


*************************************
** "Rationale" for the IV analysis **
*************************************

** The Generation of the TA_first dummy variable
gen caring_first=.
recode caring_first (.=1) if Q_Version==1 | Q_Version==2
recode caring_first (.=0)
label var caring_first "Caring items first"
tab caring_first

ttest care if IMC2==1, by(caring_first) 
ttest SPIG_With_Neut_Corrected if IMC2==1, by(caring_first) 

*******************************************
** IV (2sls) Regressions: TA_first as IV **
*******************************************
set more off
ivregress 2sls SPIG_With_Neut_Corrected Age gender Religiosity Trust ///
Political_Interest R_Ideology Total_no_of_teachers Diversity_count8  ///
i.department i.university (care = caring_first) if IMC2==1, vce(cluster Coding_Order) first
estat firststage


**************************************
*** Analysis after the IV analyses ***
**************************************
regress care SPIG_With_Neut_Corrected Age gender Religiosity Trust ///
Political_Interest R_Ideology Total_no_of_teachers Diversity_count8 ///
i.department i.university if IMC2==1 & caring_first==0, cluster (Coding_Order)

regress care SPIG_With_Neut_Corrected Age gender Religiosity Trust ///
Political_Interest R_Ideology Total_no_of_teachers Diversity_count8 ///
i.department i.university if IMC2==1 & caring_first==1, cluster (Coding_Order)

regress care c.SPIG_With_Neut_Corrected##i.caring_first Age gender Religiosity Trust ///
Political_Interest R_Ideology Total_no_of_teachers Diversity_count8 ///
i.department i.university if IMC2==1, cluster (Coding_Order)




********************************************************
*** Analysis conducted in the Supplementary Material ***
********************************************************

	
***********************************
** Summary statistics (Table A1) **
***********************************	
gen q5_01=(Q5-1)/4
gen q6_01=(Q6-1)/4
outreg2 using Table_A1_sum_stat.doc if IMC2==1, replace sum(log) ///
keep(R_Ideology Teachers_Ideo SPIG_With_Neut_Corrected care q5_01 q6_01 Age ///
gender Religiosity Trust Political_Interest Total_no_of_teachers Diversity_count8 ///
Grades Class_Participation Year_Study Not_Jewish Adj_PPB7 Adj_Fear)

** Differences b/w those who passes/failed the IMC **
ttest Age, by(IMC2) 
ttest Political_Interest, by(IMC2) 
ttest R_Ideology, by(IMC2) 
ttest Religiosity, by(IMC2)
ttest Trust, by(IMC2) 

tab gender IMC2, chi col


**********************************
** Table A2: Testing projection **
**********************************
* Correlation analyses before the table analyses
pwcorr Teachers_Ideo R_Ideology if IMC2==1, sig /* r=.14, p = .0011*/

* Model 1 
regress Teachers_Ideo R_Ideology i.department i.university if IMC2==1, cluster (Coding_Order)
outreg2 using Table_A2.doc, replace se dec(3) alpha (.001, .01, .05, .1) symbol (***, **, *, +) ///
drop (i.department i.university) addtext(Universities and departments controls, "YES")  

* Model 2
regress Teachers_Ideo c.R_Ideology##c.care i.department i.university if IMC2==1, cluster (Coding_Order)
outreg2 using Table_A2.doc, append se dec(3) alpha (.001, .01, .05, .1) symbol (***, **, *, +) ///
drop (i.department i.university) addtext(Universities and departments controls, "YES")  



*********************************************************************
** Table A3: Main text analyses (Table 1) - with the entire sample **
*********************************************************************

* Model 1 - With dummies for Department & University & Questionnaire_Versions
regress care SPIG_With_Neut_Corrected i.department i.university i.Q_Version, cluster (Coding_Order)
outreg2 using Table_A3.doc, replace se dec(3) alpha (.001, .01, .05, .1) ///
symbol (***, **, *, +) drop (i.department i.university i.Q_Version)  ///
addtext(Universities and departments controls, "YES", Matching on observables, "NO")  

* Model 2 - With individual level variables + Department & University & Questionnaire_Versions Dummies.
regress care SPIG_With_Neut_Corrected Age gender Religiosity Trust ///
Political_Interest R_Ideology Total_no_of_teachers Diversity_count8	 ///
i.department i.university i.Q_Version, cluster (Coding_Order)
outreg2 using Table_A3.doc, append se dec(3) alpha (.001, .01, .05, .1) ///
symbol (***, **, *, +) drop (i.department i.university i.Q_Version) ///
addtext(Universities and departments controls, "YES", Matching on observables, "NO") 

* Model 3 - Matching
* Creating an average-based split in the Perceived Ideological Distance measure
sum SPIG_With_Neut_Corrected, 
gen SPIG_high_avg2=1 if SPIG_With_Neut_Corrected>1.129729 & SPIG_With_Neut_Corrected<=6
replace SPIG_high_avg2=0 if SPIG_With_Neut_Corrected>=0 & SPIG_With_Neut_Corrected<=1.129729

* The analysis with the average-based split
set more off
ebalance SPIG_high_avg2 Age gender Religiosity Trust Political_Interest ///
R_Ideology Total_no_of_teachers Diversity_count8, targets(1)
svyset [pweight=_webal]
svy: regress care SPIG_high_avg2 i.department i.university i.Q_Version
outreg2 using Table_A3.doc, append se dec(3) alpha (.001, .01, .05, .1) ///
symbol (***, **, *, +) drop (i.department i.university i.Q_Version) ///
addtext(Universities and departments controls, "YES", Matching on observables, "YES")  ///
addnote(All models also control for the different questionnaire versions.)


** Model 4 - Interaction b/w the PIG item and right-wing students
regress care SPIG_With_Neut_Corrected Age gender Religiosity Trust Political_Interest ///
R_Ideology Total_no_of_teachers Diversity_count8 i.department i.university ///
i.Q_Version right SPIG_right, cluster (Coding_Order)
outreg2 using Table_A3.doc, append se dec(3) alpha (.001, .01, .05, .1) ///
symbol (***, **, *, +) drop (i.department i.university i.Q_Version) ///
addtext(Universities and departments controls, "YES", Matching on observables, "NO")  ///
addnote(All models also control for the different questionnaire versions.)


***************************************************************************************
** Other analyses with the entire sample (not shown in the main text/Supp. Material) **
***************************************************************************************

** IV Regressions **
set more off
ivregress 2sls SPIG_With_Neut_Corrected Age gender Religiosity Trust ///
Political_Interest R_Ideology Total_no_of_teachers Diversity_count8  ///
i.department i.university (care = caring_first), vce(cluster Coding_Order) first
estat firststage
* The results are very similar to those of the main text *


** Analysis after the IV analyses **
regress care SPIG_With_Neut_Corrected Age gender Religiosity Trust ///
Political_Interest R_Ideology Total_no_of_teachers Diversity_count8 ///
i.department i.university if caring_first==0, cluster (Coding_Order)

regress care SPIG_With_Neut_Corrected Age gender Religiosity Trust ///
Political_Interest R_Ideology Total_no_of_teachers Diversity_count8 ///
i.department i.university if caring_first==1, cluster (Coding_Order)

regress care c.SPIG_With_Neut_Corrected##i.caring_first Age gender Religiosity Trust ///
Political_Interest R_Ideology Total_no_of_teachers Diversity_count8 ///
i.department i.university, cluster (Coding_Order)
/* In this model, as in the model reported in the main text, the coefficient of 
the interaction is insignificant (p = .742) */


******************************************
** Robustness tests - Part 1 (Table A4) **
******************************************
* Model 1 - with self-reported grade average
regress care SPIG_With_Neut_Corrected Age gender Religiosity Trust ///
Political_Interest R_Ideology Total_no_of_teachers Diversity_count8 Grades ///
i.department i.university i.Q_Version if IMC2==1, cluster (Coding_Order)
outreg2 using Table_A4.doc, replace se dec(3) alpha (.001, .01, .05, .1) ///
symbol (***, **, *, +) drop (i.department i.university i.Q_Version)  ///
addnote(Models 1-5 also control for the different universities and departments, while ///
Model 6 control for the different cohorts. All models also control for the different questionnaire versions.)

* Model 2 - with self-reported level of participation in class
regress care SPIG_With_Neut_Corrected Age gender Religiosity Trust ///
Political_Interest R_Ideology Total_no_of_teachers Diversity_count8 Class_Participation ///
i.department i.university i.Q_Version if IMC2==1, cluster (Coding_Order)
outreg2 using Table_A4.doc, append se dec(3) alpha (.001, .01, .05, .1) ///
symbol (***, **, *, +) drop (i.department i.university i.Q_Version) 

* Model 3 - with dummay variables for 2nd- and 3rd-year students (4th- and 5th-year students were omitted from the analysis
regress care SPIG_With_Neut_Corrected Age gender Religiosity Trust ///
Political_Interest R_Ideology Total_no_of_teachers Diversity_count8 Second_Year Third_Year  ///
i.department i.university i.Q_Version if IMC2==1 & Year_Study<4, cluster (Coding_Order)
outreg2 using Table_A4.doc, append se dec(3) alpha (.001, .01, .05, .1) ///
symbol (***, **, *, +) drop (i.department i.university i.Q_Version) 

* Model 4 - with Dummay variable for non-Jewish students
regress care SPIG_With_Neut_Corrected Age gender Religiosity Trust ///
Political_Interest R_Ideology Total_no_of_teachers Diversity_count8  Not_Jewish ///
i.department i.university i.Q_Version if IMC2==1, cluster (Coding_Order)
outreg2 using Table_A4.doc, append se dec(3) alpha (.001, .01, .05, .1) ///
symbol (***, **, *, +) drop (i.department i.university i.Q_Version) 

* Model 5 - with Perceived Political Bias and Fear to Express Opinion in Class items
regress care SPIG_With_Neut_Corrected Age gender Religiosity Trust ///
Political_Interest R_Ideology Total_no_of_teachers Diversity_count8  ///
Adj_PPB7 Adj_Fear i.department i.university i.Q_Version if IMC2==1, cluster (Coding_Order)
outreg2 using Table_A4.doc, append se dec(3) alpha (.001, .01, .05, .1) ///
symbol (***, **, *, +) drop (i.department i.university i.Q_Version) 


* Model 5 - with i/a b/w Perceived Ideological Distance & Perceived Political Bias 
regress care c.SPIG_With_Neut_Corrected##c.Adj_PPB7 Age gender Religiosity Trust ///
Political_Interest R_Ideology Total_no_of_teachers Diversity_count8  Adj_Fear ///
i.department i.university i.Q_Version if IMC2==1, cluster (Coding_Order)

* Model 5 - with i/a b/w Perceived Ideological Distance & Fear to Express Opinion in Class 
regress care c.SPIG_With_Neut_Corrected##c.Adj_Fear Age gender Religiosity Trust ///
Political_Interest R_Ideology Total_no_of_teachers Diversity_count8 Adj_PPB7  ///
i.department i.university i.Q_Version if IMC2==1, cluster (Coding_Order)

* Model 6 - with dummies for Each Cohort
regress care SPIG_With_Neut_Corrected Age gender Religiosity Trust ///
Political_Interest R_Ideology Total_no_of_teachers Diversity_count8 ///
 i.Coding_Order i.Q_Version if IMC2==1, cluster (Coding_Order)
outreg2 using Table_A4.doc, append se dec(3) alpha (.001, .01, .05, .1) ///
symbol (***, **, *, +) drop (i.Coding_Order i.Q_Version) 


******************************************
** Robustness tests - Part 2 (Table A5) **
******************************************
* Model 1 - predicting the first question from the care scale
gen Q5_01=(Q5-1)/4
regress Q5_01 SPIG_With_Neut_Corrected Age gender Religiosity Trust ///
Political_Interest R_Ideology Total_no_of_teachers Diversity_count8 ///
i.department i.university i.Q_Version if IMC2==1, cluster (Coding_Order) 
outreg2 using Table_A5.doc, replace se dec(3) alpha (.001, .01, .05, .1) ///
symbol (***, **, *, +) drop (i.department i.university i.Q_Version)  ///
addtext(Universities and departments controls, "YES") ///
addnote(All models also control for the different questionnaire versions.)

* Model 2 - predicting the second question from the care scale
gen Q6_01=(Q6-1)/4
regress Q6_01 SPIG_With_Neut_Corrected Age gender Religiosity Trust ///
Political_Interest R_Ideology Total_no_of_teachers Diversity_count8 ///
i.department i.university i.Q_Version if IMC2==1, cluster (Coding_Order) 
outreg2 using Table_A5.doc, append se dec(3) alpha (.001, .01, .05, .1) ///
symbol (***, **, *, +) drop (i.department i.university i.Q_Version)  ///
addtext(Universities and departments controls, "YES") 
drop Q5_01 Q6_01

** Using ordinal regressions (results not shown in the SM)
* Model 1 - predicting the first question from the Professors Evaluations variable
ologit Q5 SPIG_With_Neut_Corrected Age gender  Religiosity Trust ///
Political_Interest R_Ideology Total_no_of_teachers Diversity_count8 ///
i.department i.university i.Q_Version if IMC2==1, cluster (Coding_Order) 

* Model 2 - predicting the second question from the Professors Evaluations variable
ologit Q6 SPIG_With_Neut_Corrected Age gender Religiosity Trust ///
Political_Interest R_Ideology Total_no_of_teachers Diversity_count8 ///
i.department i.university i.Q_Version if IMC2==1, cluster (Coding_Order) 


***********************************************************
** Balance checks across the caring_first dummy variable **
***********************************************************
* Gender
tab gender caring_first if IMC2==1, chi2

* Non-Jewish Students
tab Not_Jewish caring_first if IMC2==1, chi2

* Non-Hebrew speaking Students
tab Non_Hebrew_Speaker caring_first if IMC2==1, chi2

* Age
oneway Age caring_first if IMC2==1, t

* Religiosity
oneway Religiosity caring_first if IMC2==1, t

* Ideological Position
oneway R_Ideology caring_first if IMC2==1, t

* Trust
oneway Trust caring_first if IMC2==1, t

* Political Interest
oneway Political_Interest caring_first if IMC2==1, t

*************************************************************************
** Randomization checks for the caring_first dummy Variable (Table A6) **
*************************************************************************

** Model 1 - with only students who passed the IMC test
logit caring_first Age gender Religiosity Trust Political_Interest ///
R_Ideology Not_Jewish if IMC2==1, r
outreg2 using Table_A6.doc, replace se dec(3) alpha (.001, .01, .05, .1) ///
symbol (***, **, *, +) addstat(Model's Chi-squared statistic, (e(chi2)), Model's significance, (e(p)), ///
Model's pseudo R-Squared, (e(r2_p)))

** Model 2 - with the entire sample 
logit caring_first Age gender Religiosity Trust Political_Interest ///
R_Ideology Not_Jewish, r
outreg2 using Table_A6.doc, append se dec(3) alpha (.001, .01, .05, .1) ///
symbol (***, **, *, +) addstat(Model's Chi-squared statistic, (e(chi2)), Model's significance, (e(p)), ///
Model's pseudo R-Squared, (e(r2_p)))


**************************************
** IV (2sls) Regressions (Table A7) **
**************************************

** The analysis shown in the Supplementary Material
set more off
ivregress 2sls SPIG_With_Neut_Corrected Age gender Religiosity Trust ///
Political_Interest R_Ideology Total_no_of_teachers Diversity_count8  ///
i.department i.university (care = caring_first) if IMC2==1, vce(cluster Coding_Order) first
estat firststage

** The analysis we only mentioned in the Supplementary Material
set more off
ivregress 2sls SPIG_With_Neut_Corrected (care = caring_first) if IMC2==1, vce(cluster Coding_Order) first
estat firststage

